import java.util.concurrent.CyclicBarrier;

/**
 * Sleigh that takes Santa and the Reindeer around the world.
 */
public class Sleigh {

	// Barrier that starts the trip when santa and the reindeer are ready
	public static final CyclicBarrier allReady = new CyclicBarrier(
			Properties.TOTAL_REINDEER + 1, new Runnable() {
				public void run() {
					goOnTrip();
				}
			});

	/**
	 * Prints that the reindeer and Santa are delivering presents and sleeps for
	 * how long the trip takes.
	 */
	private static void goOnTrip() {

		try {
			System.out
					.println("Santa and his reindeer go to deliver presents to the sweet children of the world.");
			Thread.sleep(Properties.TRIP_TIME);
			System.out
					.println("Santa and his reindeer are done delivering presents.");
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}